<div id="maincontent">

<%= render :partial => "shared_common_files/data_area_help_bar" %>

<h2>Role > Edit</h2>
						<!-- h2>Edit Role</h2 -->
						<!-- h5>Edit role definition for '<%= @role.name %>'</h5 -->

<%= render_partial "form" %>

<%= start_form_tag ({:action => 'edit'},{:id => @role}) %>

<div  id="accesssecuritylist" style="display: none;">

<div id="role_editor" class="object_editor">

<div id="role_permissions">
  <h2>Access Security(Permissions)</h2>
<div  class="list">
  <table id="role_permission_table">
    <thead >
    <tr >

    <% @all_actions.each_key do |controller_name|
        controller_id = controller_name.gsub("/", "_") 
        #perms_id = controller_id + "_perms"
     %>
    <th><%= controller_name.capitalize %>
     <!--   <ul>
          <li><a href="#" onclick="checkAll('permissions_<%= controller_id %>[]'); return false;">all</a></li>
          <li><a href="#" onclick="uncheckAll('permissions_<%= controller_id %>[]'); return false;">none</a></li>
         </ul>
     -->
      </th>
  
  <% end %>
    </tr></thead>
    <tbody>
    <tr>
  <% @all_actions.each_key do |controller_name|
        controller_id = controller_name.gsub("/", "_") %>
        <td valign="top">
        <ul style="list-style-type: none; list-style-image:none; margin-left: 0px; padding-left: 0px; margin-top: 5px; text-align: top;">
         <% @all_actions[controller_name].each do |permission| %>
        <li>
        <input type="checkbox" id="<%= controller_id + "_" + permission.action %>" name="permissions_<%= controller_id %>[]" value="<%= permission.id %>" 
        <% if @role.permissions.include?(permission) %>checked="checked"<% end %>/>
        <%= link_if_authorized(permission.action.capitalize, {:controller => "permission", :action => "show", :id => permission}, 
        {:title => permission.description, :show_text => true}) %>
        </li>
        <%  end %>
        </ul>
        </td>
  <% end %>
    </tr></tbody>
  </table>
  
</div>
</div> 
    
<div class="list">
	<table>
	     <th>Actions</th>
         <tr class="even">
            <td>
               <!-- <%= link_if_authorized image_tag('/themes/odotclassic/images/btn_save.gif'), {:action => 'new'}  %> -->
              <!-- %= submit_tag 'Save' % -->
              <!-- %= link_if_authorized submit_tag('Show Role'), {:action => 'show', :id => @role}  % -->
              <!-- %= link_if_authorized submit_tag('List Roles'), {:action => 'list'}  % -->

              <%= image_submit_tag "/themes/odotclassic/images/btn_save.png", :alt => 'Save', :border => 0 %>
              <%= link_if_authorized image_tag('/themes/odotclassic/images/btn_showrole.png', :alt => 'Show'), {:action => 'show', :id => @role}  %>
              <%= link_if_authorized image_tag('/themes/odotclassic/images/btn_listroles.png', :alt => 'List'), {:action => 'list'}  %>  
            </td>
         </tr>        
	</table>
</div>
  <%= end_form_tag %>
</div>
</div>



<!-- Data security code starts here -->

<%= render :partial => "dataaccess/dataaccess_matrix" %>

<!-- Data security code ends here -->
       
   
   </div>
   